package com.sbs.demo.common;

import lombok.Getter;

/**
 * Result Code Enum
 *
 * @author luwenmin
 */
@Getter
public enum ResultCode {
    /**
     * 用户认证
     */
    UNAUTHORIZED(40003, "帐号验证失败,请重新登录"),

    /**
     * 通用
     */
    SENTINEL_LIMIT(429, "活动太火爆了，请稍后重试～"),
    INTERNAL_SERVER_ERROR(500, "系统繁忙，请稍后再试"),

    /**
     * 三方接口侧
     */
    API_NETWORK_ERROR(600, "服务加载异常，请重试"),
    API_TIMEOUT(601, "服务加载异常，请重试"),
    API_INVALID_RESPONSE(602, "服务加载异常，请重试"),

    /**
     * 用户侧
     */
    INVALID_PARAMETER(400000, "参数不正确"),
    INVALID_SIGNATURE(400001, "签名校验失败"),
    METHOD_NOT_ALLOWED(400002, "请求方法不正确"),
    REAL_NAME_FAILED(400003, "实名认证失败"),
    REAL_PERSON_FAILED(400004, "实人认证失败"),
    PERMISSION_DENIED(400005, "没有权限"),

    /**
     * 服务侧
     */
    OPERATION_FAILED(500000, "操作失败"),
    DATA_NOT_FOUND(500001, "数据不存在"),
    DATA_DUPLICATED(500002, "数据已存在"),
    API_LOGIC_ERROR(500003, "服务加载异常，请重试"),
    QUOTA_LIMIT(500004, "已达到上限"),
    SERVICE_COMMON(500005, "业务异常");


    ResultCode(int code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    /**
     * 错误码
     */
    final int code;
    /**
     * 错误信息
     */
    final String msg;

}
